<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>签到</title>
    <link rel="stylesheet" href="layui-v2.6.8/layui/css/layui.css">
    <script src="jquery/jquery-1.7.2.min.js"></script>
    <style>
        #main{
            width: 100%;
            height: 700px;
            background-image: url("img/IMG_20210329_233833.jpg");
            background-size: cover;
        }
        #main{
            position: relative;
        }
        .box{
            position: absolute;
            top: 300px;
            right: 400px;
        }
    </style>


</head>
    <body>
    <ul class="layui-nav">
        <li class="layui-nav-item" ><a href="qiandao.html" style="font-size: 20px">我要签到</a></li>
        <li class="layui-nav-item" ><a href="out.html" style="font-size: 20px">我要离开</a></li>
        <li class="logo" style="float: right"><a href=""><img src="img/logo.png" width="60px" height="60px"></a></li>
        <li class="layui-nav-item" style="float: right" ><a href="zuche.html" style="font-size: 20px">我要注册</a></li>
        <li class="text_center" style="float: right;margin-right: 400px;line-height: 60px;color: gray;font-size: 30px" >智能软件研发实验室</li>
        <li class="layui-nav-item" ><a href="total.html" style="font-size: 20px">签到统计</a></li>
    </ul>
    <div id="main">
        <div class="box">
            <div class="layui-input-inline">
                <input type="text" name="username" lay-verify="required" placeholder="请输入学号" autocomplete="off" class="layui-input" style="width:400px;" id="value">
            </div>
            <button type="submit" class="layui-btn layui-btn-radius" id="btn">签到</button>
        </div>
    </div>
</body>
<script>
    $(function (){
        $("#btn").click(function (){
            var username=$("#value").val()
                $.ajax({
                    url: "/sign",
                    type: "get",
                    data:{
                        stuid:username
                    },
                    success: function (data) {
                        if(data){
                            alert("签到成功")
                        }else{
                            alert("签到失败，学号为空或者上次未结束签到")
                        }
                    },
                });
        })
    })
</script>
</html>